<template>
  <div>
    <van-nav-bar
      fixed
      left-arrow
      :border="false"
      title="我的账户"
      @click-left="$utils.back($route.path);"
    />
    <div class="has-top">
      <div class="flex-s-c fs-32 mg-24 mt-40 fw-b">
        <p>{{ storeInfo.ShowName }}（{{ storeInfo.V_Card_Number||storeInfo.CardNumber }}）</p>
        <p>货款：{{ storeInfo.RechargeBalance||0 }}元</p>
      </div>
      <div class="mg-24 mt-40 list">
        <div v-for="(item,index) in linkList" :key="index" class="item flex-s-c" @click="go(item)">
          <div class="flex-1">
            <p class="title">{{ item.title }}</p>
          </div>
          <div class="right-arrow" />
        </div>
      </div>
      <div class="mg-24 list">
        <div v-for="(item,index) in secondLinkList" :key="index" class="item flex-s-c" @click="go(item)">
          <div class="flex-1">
            <p class="title">{{ item.title }}</p>
          </div>
          <div class="right-arrow" />
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { GetUserStore } from 'api/store'
export default {
  components: {
  },

  data() {
    return {
      storeInfo: {},
      linkList: [
        {
          title: '货款明细',
          link: '/user/paymentList',
          linkType: 1
        },
        {
          title: '我要充值',
          link: '/m/user/ApplyRecharge',
          linkType: 0
        },
        {
          title: '我的钱包',
          link: '/user/wallet',
          linkType: 1
        },
        {
          title: '认证账户',
          link: '/accountApply',
          linkType: 1
        }
        // {
        //   title: '收款账户',
        //   link: '/m/user/BankList',
        //   linkType: 0
        // }
        // {
        //   title: '转账下级',
        //   link: '/m/user/Transfer',
        //   linkType: 0
        // }
      ],
      secondLinkList: [
        {
          title: '销售业绩',
          link: '/m/User/LowerDealerList3',
          linkType: 0
        },
        {
          title: '团队业绩',
          link: '/m/user/PerformanceRewards',
          linkType: 0
        }
      ]
    }
  },
  computed: {
  },
  created() {
    this.GetUserStore()
  },
  activated() {},
  methods: {
    go(data) {
      switch (data.linkType) {
        case 0:
          window.location.href = data.link
          break
        case 1:
          this.$router.push({
            path: data.link
          })
          break
        default:
          break
      }
    },
    GetUserStore() {
      GetUserStore().then(res => {
        if (res && res.Data) {
          this.storeInfo = res.Data
          if (this.storeInfo.V_RealName) {
            this.storeInfo.ShowName = this.storeInfo.V_RealName
          } else if (this.storeInfo.V_NickName) {
            this.storeInfo.ShowName = this.storeInfo.V_NickName
          } else if (this.storeInfo.ContactName) {
            this.storeInfo.ShowName = this.storeInfo.ContactName
          } else if (this.storeInfo.Name) {
            this.storeInfo.ShowName = this.storeInfo.Name
          }
          // if (res.Data.DealerGradesName != '经销商') {
          //   this.$toast('没有访问权限')
          //   this.$utils.back(this.$route.path)
          // }
        } else {
          window.location.href = '/m'
        }
      })
    }
  }
}
</script>
<style lang="scss" scoped>
.list{
  background: #fff;
  border-radius: 16px;
  .item{
    display: flex;
    padding: 32px 20px 32px 0;
    margin-left: 24px;
    &:not(:last-child){
      border-bottom: 1px solid #F0F0F0;
    }
    .img-icon{
      width: 48px;
      height: 48px;
      margin-right:24px ;
    }
    .title{
      font-size: 30px;
    }
    .text{
      margin-top: 16px;
    }
    .right-arrow{
      width: 32px;
      height: 32px;
      flex-shrink: 0;
      flex-grow: 0;
      margin-left: 20px;
      // border-radius: 16px;
      // background: #F1F1F1;
      position: relative;
      &:after{
        content: '';
        width: 8px;
        height: 8px;
        border: 2px solid;
        border-color: #333 #333 transparent transparent;
        position: absolute;
        top: 10px;
        left: 8px;
        transform: rotate(45deg);
      }
    }
  }
}
.logout-btn{
  margin: 48px 40px;
  font-size: 32px;
  line-height: 88px;
  border-radius: 45px;
  border: 1px solid currentColor;
  text-align: center;
}
</style>
